import org from './org'
import task from './task'
import settle from './settle'
import report from './report'
import loan from './loan'
import program from './program'
import customer from './customer'
import risk from './risk'
import goods from './goods'
import archives from './archives'
import letter from './letter'

export default [
  {
    path: '/',
    component: () => import(/* webpackChunkName: "credit-app" */ '@/credit/views/city/Layout.vue'),
    meta: {
      root: true,
      title: '农业大数据信用服务平台',
      authExecutor: user => !user.scopeArr.includes('dirGuaPro'),
      org: ['org_credit'],
    },
    children: [
      {
        path: '',
        redirect: 'credit',
      },
      {
        path: 'credit',
        component: { render: h => h('router-view') },
        meta: { title: '信用服务', icon: 'fa fa-fw fa-home', hidden: true },
        children: [
          {
            path: '',
            redirect: 'index',
          },
          {
            path: 'index',
            component: () =>
              import(
                /* webpackChunkName: "credit-index" */ '@/bigcredit/views/index/manage/Index.vue'
              ),
            meta: { title: '主页', icon: 'fa fa-home', excludeJob: ['org_c_emp'] },
          },
          {
            path: 'index',
            component: () =>
              import(/* webpackChunkName: "credit-resIndex" */ '@/bigcredit/views/index/Index.vue'),
            meta: { title: '主页', icon: 'fa fa-fw fa-home', job: ['org_c_emp'] },
          },
          {
            path: 'customer',
            component: () =>
              import(/* webpackChunkName: "credit-customer" */ '@/components/AliveView.vue'),
            meta: { title: '客户管理', icon: 'fa fa-fw fa-user-o', excludeJob: ['org_c_emp'] },
            children: customer,
          },
          {
            path: 'program',
            component: () =>
              import(/* webpackChunkName: "credit-county-program" */ '@/components/AliveView.vue'),
            meta: { title: '项目管理', icon: 'fa fa-fw fa-list' },
            children: program,
          },
          {
            path: 'task',
            component: { render: h => h('router-view') },
            meta: {
              title: '融资业务',
              icon: 'fa fa-fw fa-newspaper-o',
            },
            children: task,
          },

          {
            path: 'letter',
            component: () =>
              import(/* webpackChunkName: "credit-county-program" */ '@/components/AliveView.vue'),
            meta: { title: '保函业务', icon: 'fa fa-envira fa-list', scopes: ['guarantee'] },
            children: letter,
          },

          {
            path: 'loan',
            component: () =>
              import(/* webpackChunkName: "credit-report" */ '@/components/AliveView.vue'),
            meta: { title: '保后管理', icon: 'fa fa-fw fa-shield' },
            children: loan,
          },
          {
            path: 'risk',
            component: () =>
              import(/* webpackChunkName: "credit-report" */ '@/components/AliveView.vue'),
            meta: { title: '风险管理', icon: 'fa fa-fw fa-bug' },
            children: risk,
          },
          {
            path: 'settle',
            component: () =>
              import(/* webpackChunkName: "credit-settle" */ '@/components/AliveView.vue'),
            meta: { title: '结算管理', icon: 'fa fa-fw fa-wpforms' },
            children: settle,
          },
          {
            path: 'archives',
            component: () =>
              import(/* webpackChunkName: "credit-archives" */ '@/components/AliveView.vue'),
            meta: { title: '档案管理', icon: 'fa fa-fw fa-file-pdf-o', hidden: true },
            children: archives,
          },
          {
            path: 'goods',
            component: () =>
              import(/* webpackChunkName: "credit-goods" */ '@/components/AliveView.vue'),
            meta: {
              title: '产品管理',
              icon: 'fa fa-fw fa-file-archive-o',
              authExecutor: user => user.scopeArr.includes('agencyM') || user.job !== 'org_c_emp',
            },
            children: goods,
          },
          {
            path: 'eletter',
            component: () =>
              import(/* webpackChunkName: "credit-flow" */ '@/bigcredit/views/eletter/Index.vue'),
            meta: {
              title: '保函制作',
              icon: 'fa fa-fw fa-envelope-open-o',
              scopes: ['eleMake'],
            },
          },
          {
            path: 'org',
            component: () =>
              import(/* webpackChunkName: "credit-org" */ '@/components/AliveView.vue'),
            meta: {
              title: '合作机构',
              icon: 'fa fa-fw fa-address-card-o',
              authExecutor: user => user.scopeArr.includes('agencyM') || user.job !== 'org_c_emp',
            },
            children: org,
          },
          {
            path: 'report',
            component: () =>
              import(/* webpackChunkName: "credit-report" */ '@/components/AliveView.vue'),
            // , excludeJob: ['org_c_emp']
            meta: { title: '台账报表', icon: 'fa fa-fw fa-file-text-o' },
            children: report,
          },
          // {
          //   path: 'user_org',
          //   name: 'userOrg',
          //   component: () =>
          //     import(/* webpackChunkName: "credit-user" */ '@/credit/views/county/user/Org.vue'),
          //   meta: { title: '组织结构', hidden: true },
          // },
          {
            path: 'flow',
            component: () =>
              import(/* webpackChunkName: "credit-flow" */ '@/credit/views/county/flow/Index.vue'),
            meta: { title: '流程管理', hidden: true },
          },
        ],
      },
    ],
  },
  {
    path: '*',
    redirect: '/error',
    hidden: true,
  },
]
